<template>
  <div class="q-pa-md">
    <t-layout
      view="lHh Lpr lFf"
      container
      style="height: 400px"
      class="shadow-2 rounded-borders"
    >
      <t-header reveal elevated>
        <t-toolbar>
          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerLeft = !drawerLeft"
          />

          <t-toolbar-title> <strong>Quasar</strong> Framework </t-toolbar-title>

          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerRight = !drawerRight"
          />
        </t-toolbar>
      </t-header>

      <t-footer reveal elevated>
        <t-toolbar>
          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerLeft = !drawerLeft"
          />

          <t-toolbar-title> <strong>Quasar</strong> Framework </t-toolbar-title>

          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerRight = !drawerRight"
          />
        </t-toolbar>
      </t-footer>

      <t-drawer
        v-model="drawerLeft"
        :width="150"
        :breakpoint="700"
        behavior="desktop"
        bordered
        :class="$q.dark.isActive ? 'bg-grey-9' : 'bg-grey-3'"
      >
        <t-scroll-area class="fit">
          <div class="q-pa-sm">
            <div v-for="n in 50" :key="n">Drawer {{ n }} / 50</div>
          </div>
        </t-scroll-area>
      </t-drawer>

      <t-drawer
        side="right"
        v-model="drawerRight"
        bordered
        :width="150"
        :breakpoint="500"
        behavior="desktop"
        :class="$q.dark.isActive ? 'bg-grey-9' : 'bg-grey-3'"
      >
        <t-scroll-area class="fit">
          <div class="q-pa-sm">
            <div v-for="n in 50" :key="n">Drawer {{ n }} / 50</div>
          </div>
        </t-scroll-area>
      </t-drawer>

      <t-page-container>
        <t-page padding>
          <p v-for="n in 15" :key="n">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit nihil
            praesentium molestias a adipisci, dolore vitae odit, quidem
            consequatur optio voluptates asperiores pariatur eos numquam rerum
            delectus commodi perferendis voluptate?
          </p>

          <!-- place QPageSticky at end of page -->
          <t-page-sticky position="top-left" :offset="[18, 18]">
            <t-btn round color="accent" icon="arrow_back" class="rotate-45" />
          </t-page-sticky>
          <t-page-sticky position="top" :offset="[0, 18]">
            <t-btn round color="accent" icon="arrow_back" class="rotate-90" />
          </t-page-sticky>
          <t-page-sticky position="top-right" :offset="[18, 18]">
            <t-btn round color="accent" icon="arrow_upward" class="rotate-45" />
          </t-page-sticky>
          <t-page-sticky position="right" :offset="[18, 0]">
            <t-btn round color="accent" icon="arrow_upward" class="rotate-90" />
          </t-page-sticky>
          <t-page-sticky position="left" :offset="[18, 0]">
            <t-btn round color="accent" icon="arrow_back" />
          </t-page-sticky>
          <t-page-sticky position="bottom-left" :offset="[18, 18]">
            <t-btn
              round
              color="accent"
              icon="arrow_forward"
              class="rotate-135"
            />
          </t-page-sticky>
          <t-page-sticky position="bottom" :offset="[0, 18]">
            <t-btn
              round
              color="accent"
              icon="arrow_forward"
              class="rotate-90"
            />
          </t-page-sticky>
          <t-page-sticky position="bottom-right" :offset="[18, 18]">
            <t-btn
              round
              color="accent"
              icon="arrow_forward"
              class="rotate-45"
            />
          </t-page-sticky>
        </t-page>
      </t-page-container>
    </t-layout>
  </div>
</template>

<script>
  import { useQuasar } from '@teld/q-components';
  import { ref } from 'vue';

  export default {
    setup() {
      const $q = useQuasar();

      return {
        drawerLeft: ref($q.screen.width > 700),
        drawerRight: ref($q.screen.width > 500),
      };
    },
  };
</script>
